package boun.swe.bob.entities;

import java.io.Serializable;

/**
 * This entity is used for friends relationships
 */
public class FriendsPK implements Serializable{

    private Integer user1Id;
    private Integer user2Id;

    public Integer getUser1Id() {
        return user1Id;
    }

    public void setUser1Id(Integer user1Id) {
        this.user1Id = user1Id;
    }

    public Integer getUser2Id() {
        return user2Id;
    }

    public void setUser2Id(Integer user2Id) {
        this.user2Id = user2Id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        FriendsPK friendsPK = (FriendsPK) o;

        if (user1Id != null ? !user1Id.equals(friendsPK.user1Id) : friendsPK.user1Id != null) return false;
        if (user2Id != null ? !user2Id.equals(friendsPK.user2Id) : friendsPK.user2Id != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = user1Id != null ? user1Id.hashCode() : 0;
        result = 31 * result + (user2Id != null ? user2Id.hashCode() : 0);
        return result;
    }
}
